Under the routes folder lives the filesRoute.js file, it's the most important file of the app, the heart and soul of this tiny SSG. This file looks at three folders sitting under the views folder at the same time :
- The posts folder
- The pages folder
- The templates folder
It converts the content of the Markdown files in the posts and pages folders to HTML
and renders each post, page, and ESJ
template on a route matching it's filename. If the requested route doesn't match any file name inside those folders, the 404 error page will be displayed.
To understand how this file works, please take a look at it, it's pretty well documented.
You can also read more about it on my personal blog :
Since everything is explained inside the file itself and in the two articles mentioned above, I'm not going to elaborate further more about it here.
That will be all for the rendering of MarkDown and EJS files from one end to another, see you in the next one.